import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AddSettingPage extends StatefulWidget {
  AddSettingPage({Key key}) : super(key: key);

  @override
  _AddSettingPageState createState() => _AddSettingPageState();
}

class _AddSettingPageState extends State<AddSettingPage> {
  var easyId = true;
  var phone = false;
  var two = false;
  var card = true;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        title: Text(
          "隐私设置",
          style: TextStyle(fontSize: ScreenUtil().setSp(16)),
        ),
        centerTitle: true,
      ),
      body: Column(
        children: [
          Container(
            alignment: Alignment.center,
            color: Colors.white,
            margin: EdgeInsets.only(top: 10),
            child: Column(
              children: <Widget>[
                MergeSemantics(
                  child: ListTile(
                    title: Text(
                      '自语号',
                      style: TextStyle(fontSize: ScreenUtil().setSp(15)),
                    ),
                    trailing: CupertinoSwitch(
                      activeColor: Color.fromRGBO(0, 220, 169, 1),
                      value: easyId,
                      onChanged: (bool value) {
                        setState(() {
                          easyId = value;
                        });
                      },
                    ),
                    onTap: () {
                      setState(() {
                        easyId = !easyId;
                      });
                    },
                  ),
                ),
                Divider(
                  height: 1,
                  indent: ScreenUtil().setWidth(10),
                  color: Color.fromRGBO(248, 248, 248, 1),
                  thickness: ScreenUtil().setHeight(1),
                ),
                MergeSemantics(
                  child: ListTile(
                    title: Text(
                      '手机号码',
                      style: TextStyle(fontSize: ScreenUtil().setSp(15)),
                    ),
                    trailing: CupertinoSwitch(
                      activeColor: Color.fromRGBO(0, 220, 169, 1),
                      value: phone,
                      onChanged: (bool value) {
                        setState(() {
                          phone = value;
                        });
                      },
                    ),
                    onTap: () {
                      setState(() {
                        phone = !phone;
                      });
                    },
                  ),
                ),
                Divider(
                  height: 1,
                  indent: ScreenUtil().setWidth(10),
                  color: Color.fromRGBO(248, 248, 248, 1),
                  thickness: ScreenUtil().setHeight(1),
                ),
                MergeSemantics(
                  child: ListTile(
                    title: Text(
                      '二维码',
                      style: TextStyle(fontSize: ScreenUtil().setSp(15)),
                    ),
                    trailing: CupertinoSwitch(
                      activeColor: Color.fromRGBO(0, 220, 169, 1),
                      value: two,
                      onChanged: (bool value) {
                        setState(() {
                          two = value;
                        });
                      },
                    ),
                    onTap: () {
                      setState(() {
                        two = !two;
                      });
                    },
                  ),
                ),
                Divider(
                  height: 1,
                  indent: ScreenUtil().setWidth(10),
                  color: Color.fromRGBO(248, 248, 248, 1),
                  thickness: ScreenUtil().setHeight(1),
                ),
                MergeSemantics(
                  child: ListTile(
                    title: Text(
                      '名片',
                      style: TextStyle(fontSize: ScreenUtil().setSp(15)),
                    ),
                    trailing: CupertinoSwitch(
                      activeColor: Color.fromRGBO(0, 220, 169, 1),
                      value: card,
                      onChanged: (bool value) {
                        setState(() {
                          card = value;
                        });
                      },
                    ),
                    onTap: () {
                      setState(() {
                        card = !card;
                      });
                    },
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
